package org.smartbird
{
	public class Room extends BasicSBSObject
	{
		public var id:int;
		public var name:String;
		public var roomVariables:Object;
		public var staticFlag:Boolean;
		public var gameFlag:Boolean;
		private var userSet:Object;
		private var _userCount:int;
		private var _sbs:SmartBirdClient;
		
		public function Room(sbs:SmartBirdClient)
		{
			this._sbs = sbs;
			this.roomVariables = new Object();
			this.userSet = new Object();
			_userCount = 0;
		}
		
		public function containsUser(user:User):Boolean
		{
			return userSet[user.id] == true;
		}
		
		public function addUser(user:User):void
		{
			if (!containsUser(user))
			{
				userSet[user.id] = true;
				_userCount++;
			}
		}
		
		public function removeUser(user:User):void
		{
			if (containsUser(user))
			{
				delete userSet[user.id];
				_userCount--;
			}
		}
		
		public function get userIdList():Array
		{
			var userIds:Array = new Array();
			for (var userIdStr:String in userSet)
			{
				if (userSet[userIdStr] == true)
				{
					userIds.push(parseInt(userIdStr));
				}
			}
			return userIds;
		}

	}
}